package Java9_8;

import java.util.Objects;

public class Person {
    String name;
    int age;
    String sex;
    String zhiwu;
    int money;
    String gonghao;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getZhiwu() {
        return zhiwu;
    }

    public void setZhiwu(String zhiwu) {
        this.zhiwu = zhiwu;
    }

    public int getMoney() {
        return money;
    }

    public void setMoney(int money) {
        this.money = money;
    }

    public String getGonghao() {
        return gonghao;
    }

    public void setGonghao(String gonghao) {
        this.gonghao = gonghao;
    }
    public void show(){
        System.out.println(this.toString());
    }

    @Override
    public String toString() {
        return
                "姓名" + name + '\'' +
                "年龄" + age +
                "性别" + sex + '\'' +
                "职务" + zhiwu + '\'' +
                "薪水" + money +
                "工号" + gonghao + '\'' ;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return Objects.equals(gonghao, person.gonghao);
    }

    @Override
    public int hashCode() {
        return Objects.hash( gonghao);
    }
}
